package com.cslg.ac.demo.entity.user.person;

import com.cslg.ac.demo.util.string.StringUtil;

public class PersonInfo {
    int id;
    String image;
    String name;
    Integer gender;
    String city;
    String phone;
    String email;
    Integer accept;
    Integer grade;
    Integer loveValue;
    String synopsis;
    String idCard;
    String realName;



    public PersonInfo() {
    }


//    public boolean longAndLatVlaid(){
//        boolean notValid = (longitude != null && latitude != null ) &&
//                (longitude < -90 || longitude > 90) &&
//                (latitude < 180 || latitude > 180);
//        if(notValid){
//            return false;
//        }
//        return true;
//    }

    public boolean insertValid(int nameLength){
        if(name.equals("")|| StringUtil.lengthAbove(name,nameLength)){
            return false;
        }
        if(gender == null || (gender != 0 && gender != 1) ){
            return false;
        }
        return true;
    }

    public boolean updateValid(int nameLength,int cityLength,int phoneLength,int synopsisLength){
        if(StringUtil.lengthAbove(name,nameLength) || StringUtil.lengthAbove(city,cityLength)
                || StringUtil.lengthAbove(phone,phoneLength) || StringUtil.lengthAbove(synopsis,synopsisLength)){
            return false;
        }
        if(gender != null && (gender != 0 && gender != 1)){
            return false;
        }
        if(accept != null && (accept != 0 && accept != 1)){
            return false;
        }
        if(grade != null || loveValue != null) {
            return false;
        }
        return true;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSynopsis() {
        return synopsis;
    }

    public void setSynopsis(String synopsis) {
        this.synopsis = synopsis;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }



    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getAccept() {
        return accept;
    }

    public void setAccept(Integer accept) {
        this.accept = accept;
    }

    public Integer getGrade() {
        return grade;
    }

    public void setGrade(Integer grade) {
        this.grade = grade;
    }

    public Integer getLoveValue() {
        return loveValue;
    }

    public void setLoveValue(Integer loveValue) {
        this.loveValue = loveValue;
    }


    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }


    @Override
    public String toString() {
        return "PersonInfo{" +
                "id=" + id +
                ", image='" + image + '\'' +
                ", name='" + name + '\'' +
                ", gender=" + gender +
                ", city='" + city + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", accept=" + accept +
                ", grade=" + grade +
                ", loveValue=" + loveValue +
                ", synopsis='" + synopsis + '\'' +
                ", idCard='" + idCard + '\'' +
                ", realName='" + realName + '\'' +
                '}';
    }


}
